apiVersion: apps/v1
kind: Deployment
metadata:
  name: pulsar
  namespace: {{ .Values.namespace }}
spec:
  replicas: 1
  selector:
    matchLabels:
      app: pulsar
  template:
    metadata:
      labels:
        app: pulsar
    spec:
      containers:
        - name: pulsar
          image: apachepulsar/pulsar
          command: [ "/pulsar/bin/pulsar", "standalone" ]

          ports:
            - containerPort: 6650
            - containerPort: 8080
          volumeMounts:
            - name: pulsardata
              mountPath: /pulsar/data
          readinessProbe:
             httpGet:
               path: /admin/v2/brokers/health
               port: 8080
             initialDelaySeconds: 10
             periodSeconds: 5
      volumes:
        - name: pulsardata
          emptyDir: {}
---
apiVersion: v1
kind: Service
metadata:
  name: pulsar
  namespace: {{ .Values.namespace }}
spec:
  ports:
    - name: pulsar-port
      port: 6650
      targetPort: 6650
    - name: admin-port
      port: 8080
      targetPort: 8080
  selector:
    app: pulsar
  type: ClusterIP